package server.life;

/**
 * @author caiwei
 * @date 2020-10-11 23:50
 */
public abstract class LifecycleBase implements Lifecycle {

    protected abstract void initInternal() throws Exception;

    @Override
    public void init() {
        System.out.println(this.getClass().getName()+"  init begin");
        try {
            initInternal();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(this.getClass().getName()+"  init finished");
    }

    @Override
    public void start() {
        System.out.println(this.getClass().getName()+"  start begin");
        startInternal();
        System.out.println(this.getClass().getName()+"  start finished");
    }

    protected abstract void startInternal();
}
